//
//  APIManager.h
//  RWUIControls
//
//  Created by shenchengcai on 15/3/3.
//  Copyright (c) 2015年 QM. All rights reserved.
//

/*******************************************************
 类名：APIManager.h
 功能描述：接口处理类，实现从接口请求数据的方法
 
 */

#import <UIKit/UIKit.h>

@class AFHTTPRequestOperation;

@interface APIManager : NSObject

+ (id)sharedInstance;
+ (id)loginInstance;

- (id) cachedContent:(NSString *)key;
- (void) setCachedContent:(id)content withKey:(NSString *)key;

+(BOOL)clientJudge;

//设置IP
+(void)sheZhiIP:(NSString *)IPString;

//请求方法。向接口请求数据，并接收返回值。path方法路径；parameters参数；success请求成功时处理方法；failure请求失败时处理方法
- (void)getPath:(NSString *)path
     parameters:(NSDictionary *)parameters
        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
        failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;

//请求方法。向接口请求数据，并接收返回值。path方法路径；parameters参数；success请求成功时处理方法；failure请求失败时处理方法
//- (void)getPath:(NSString *)path
//      parameters:(NSDictionary *)parameters
//         success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
//         failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;

//请求方法。向接口请求数据，并接收返回值。path方法路径；parameters参数；success请求成功时处理方法；failure请求失败时处理方法
- (void)postPath:(NSString *)path
      parameters:(NSDictionary *)parameters
         success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
         failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;

//请求方法。向接口请求数据，并接收返回值。path方法路径；parameters参数；dataDic需上传的数据；dataType数据类型；success请求成功时处理方法；failure请求失败时处理方法
- (void)postPath:(NSString *)path
      parameters:(NSDictionary *)parameters
         dataDic:(NSDictionary *)dataDic
        dataType:(NSString *)dataType
         success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
         failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;


//请求方法。加密向接口请求数据，并接收返回值。path方法路径；parameters参数；success请求成功时处理方法；failure请求失败时处理方法
- (void)EncryptionpostPath:(NSString *)path
                parameters:(NSDictionary *)parameters
                   success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successEnc
                   failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureEnc;

- (void)webServicePostMethod:(NSString *)method
                  parameters:(NSDictionary *)parameters
                     success:(void (^)(id responseObject))success
                     failure:(void (^)(NSError *error))failure;

@end
